const db = require('../config/db');

class Image {
  static async create(filename, filepath, mimetype, size) {
    const [result] = await db.query(
      'INSERT INTO images (filename, filepath, mimetype, size) VALUES (?, ?, ?, ?)',
      [filename, filepath, mimetype, size]
    );
    return result.insertId;
  }

  static async getAll() {
    const [rows] = await db.query('SELECT * FROM images');
    return rows;
  }

  // 可根据需求添加更多方法...
}

module.exports = Image;